<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<jsp:include page="/common/commonCss.jsp"></jsp:include>
<jsp:include page="/common/commonJs.jsp"></jsp:include>
<title>打印页面</title>
</head>
<style>
.ticket{ width:213px; border: 1px solid #ccc;background: #fff; font-size: 13px !important; font-family: "宋体";}
.ticket div{ margin-bottom: 11px;}
.ticket_bo{border-bottom:1px solid #ccc}
.table_y{ text-align: center; width: 100%}    
.table_y th{ font-weight: bold; text-align: center;}
.vb{ vertical-align: bottom;}
.fz11{ font-size: 11px!important;}
</style>

<%-- <object id="factory" style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
  codebase="${basePath }plugin/smsx.cab#Version=7,5,0,20">
</object> --%>
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0></OBJECT> 
<script defer="defer">
$(document).ready(function(){
	
	
	
	getPrintContent();
	/* if (!factory.object) {
	    alert("打印控件没有正确安装!");
	    return;
	  } else {
	    // -- advanced features
	    factory.printing.SetMarginMeasure(2); // measure margins in inches
	    factory.printing.printer = "HP DeskJet 870C";
	    factory.printing.paperSize ="B5";  
	    factory.printing.paperSource = "Manual feed";
	    factory.printing.collate = true;
	    factory.printing.copies = 2;
	    factory.printing.SetPageRange(false, 1, 3); // need pages from 1 to 3
	   
	    // -- basic features
	    factory.printing.header = "This is MeadCo";
	    factory.printing.footer = "Printing by ScriptX";
	    factory.printing.portrait = true;
	    factory.printing.leftMargin = 5.0;
	    factory.printing.topMargin = 5.0;
	    factory.printing.rightMargin = 5.0;
	    factory.printing.bottomMargin = 5.0;
	  //  factory.printing.Print(true);
	    //printTure();
	  }
	//window.print();
	//factory.printing.Preview();
	//printTure();
	 */
});
//setTimeout("window.close()",1000); //设置一个超时对象
//setTimeout("factory.printing.Preview()", 100);
</script>
<script language="javascript">
$(document).ready(function(){
	getPrintContent();
});
	
var HKEY_Root,HKEY_Path,HKEY_Key;    
HKEY_Root="HKEY_CURRENT_USER";    
HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";    
    //设置网页打印的页眉页脚为空    
		 function PageSetup_Null()   
		  {    
			try {    
					var Wsh=new ActiveXObject("WScript.Shell");    
			HKEY_Key="header";    
			Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");    
			HKEY_Key="footer";    
			Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");    
			}  catch(e){}    
		  }
 //恢复网页打印的页眉页脚   
function SetupPage() 
{ 
try{ 
var RegWsh = new ActiveXObject("WScript.Shell"); 
hkey_key="header" ;
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&w&b页码，&p/&P") ;
hkey_key="footer" ;
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&b&d"); //去掉了&u 因为我不想显示当前打印页的网址 
hkey_key="margin_bottom"; 
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"0"); //0.39相当于把页面设置里面的边距设置为10 
hkey_key="margin_left"; 
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"0"); 
hkey_key="margin_right"; 
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"0"); 
hkey_key="margin_top"; 
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"0"); 
}
catch(e){
alert(e);
} 
}

function printsetup(){ 
//打印页面设置 
wb.execwb(8,1); 
} 
function printpreview(){ 
//打印页面预览 
PageSetup_Null(); 
wb.execwb(7,1); 

} 

function printit() 
{ 
//PageSetup_Null(); 
//wb.execwb(6,1) ;
window.close();
} 


function printTure() //打印函数
{
factory.printing.Print(true); //调用控件打印
}
function Print(frame) {
factory.printing.Print(false, frame) ;// print with prompt
}
function  getPrintContent(){
	var content = window.opener.document.getElementById("contentHtml").innerHTML;  //得到父窗口中的姓名
	document.getElementById("content").innerHTML=content;
	PageSetup_Null(); 
	wb.execwb(6,2);
	window.close();
	//factory.printing.Preview();
	//factory.printing.Print(true);

}
</script>
<body>
		<!-- 需要打印的内容 -->
		<div id="content">
				
		
		</div>
		
</body>
</html>